
var baseUrl='http://127.0.0.1:8082'
var httpImgUrl="http://127.0.0.1:8082/api/upload/getImage?filePath="

// 封装 Axios 请求
var MyAxios = {
    get: function(url, params) {
        // return axios.get(baseUrl+url, { params: params });
        return new Promise((resolve, reject) => {
            axios.get(
                baseUrl+url, 
                { 
                    params: params,
                    headers: {
                        'Authorization': localStorage.getItem('hunshaToken')||'',
                    }, 
                }) .then(response => {
                resolve(response.data);
            })
            .catch(error => {
                reject(error);
            });
        });
    },
    post: function(url, data) {
        // return axios.post(baseUrl+url, data);
        return new Promise((resolve, reject) => {
            axios.post(baseUrl+url, data,{
                headers: {
                    'Authorization': localStorage.getItem('hunshaToken')||'',
                }, 
            }) .then(response => {
                resolve(response.data);
            })
            .catch(error => {
                reject(error);
            });
        });
    }
};